var defaultOpenID = "https://www.google.com/accounts/o8/id";

function loadOptions() {
	var myOpenID = localStorage["preferredOpenID"];

    if (myOpenID) {
		var select = document.getElementById("opse");
		for (var i = 0; i < select.children.length; i++) {
			var child = select.children[i];
				if (child.value == myOpenID) {
				child.selected = "true";
				return;
			}
		}
		var input = document.getElementById("opin");
		input.setAttribute("value", myOpenID);
    }
    
}

function saveOptions() {
	var select = document.getElementById("opse");
	if (select.selectedIndex) {
		var myOpenID = select.children[select.selectedIndex].value;
		localStorage["preferredOpenID"] = myOpenID;
		return;
	}
	var input = document.getElementById("opin");
	var myOpenID = input.value;
    if (myOpenID) {
    	localStorage["preferredOpenID"] = myOpenID;
		return;	
    }	
}

function eraseOptions() {
	localStorage.removeItem("preferredOpenID");
	location.reload();
}